package o;

import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.view.View;
import androidx.core.view.ViewCompat;
import com.huawei.skinner.annotation.SkinAdapter;
import o.fkp.e;

public class gcr {
    @SkinAdapter("background")
    public static void ॱ(View view, Drawable drawable) {
        if (!flr.ˋ(view.getContext()).ॱ() || view.getTag(e.ˋ) == null) {
            ViewCompat.ˏ(view, drawable);
            Object tag = view.getTag(e.ˊ);
            if (tag != null && (tag instanceof ColorStateList)) {
                ColorStateList colorStateList = (ColorStateList) tag;
                if (drawable != null) {
                    Drawable mutate = gg.ʻ(drawable).mutate();
                    gg.ॱ(mutate, colorStateList);
                    gg.ˋ(mutate, Mode.SRC_IN);
                    if (drawable != mutate) {
                        view.setBackground(mutate);
                    }
                }
            }
        }
    }

    @SkinAdapter("backgroundTint")
    public static void ˋ(View view, ColorStateList colorStateList) {
        ViewCompat.ˎ(view, colorStateList);
        if (VERSION.SDK_INT < 21 && !(view instanceof hy)) {
            Drawable background = view.getBackground();
            if (background != null) {
                Drawable mutate = gg.ʻ(background).mutate();
                gg.ॱ(mutate, colorStateList);
                gg.ˋ(mutate, Mode.SRC_IN);
                if (background != mutate) {
                    view.setBackground(mutate);
                }
            }
            view.setTag(e.ˊ, colorStateList);
        }
    }
}
